<script> 
    var total_num = 0;
    var arr_pm_code = <?=json_encode($arr_pm_code);?>;
</script>
<div class="box-content">
    <?=form_open(uri_string(),array('id'=>'checknew'));?>
    <table width="100%">
        <tr>
            <td>
               <table class="form" style="margin:auto;width:50%">
                    <tr>
                        <td class="w150 required label"><?php echo lang('group.name');?></td>
                        <td><input type="text" name="group_name"  class="w150" value="<?=set_value('group_name')?>"></td>
                    </tr>
                    <tr>
                        <td class="label"><?php echo lang('group.comment');?></td>
                        <td>
                            <textarea class ="w150" style="height: 50px;" name="group_comment"><?=set_value('group_comment')?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td class="footer"><input type="submit" name="bt_submit" class="themmoi"></td>
                    </tr>               
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <h4><?php echo lang('group.check_all');?> <input type="checkbox" name="sa" id="sa" onclick="check_chose_right('sa', total_num, 'checknew')" /><?php echo lang('admin.choose_all');?></h4>
                <table class="admindata" width="100%">
                    <?php 
                        $k=1;
                        $i=0;
                        foreach($modules as $module){
                            $functions  = $this->group->get_all_function($module->module_id);
                    ?>
                        <tr class="row<?=$k?>">
                            <td>
                                <div class="permission_name"><b><?=$module->module_name?></b> <?=($module->module_comment!='')?('['.$module->module_comment.']'):"";?></div>
                                <div style="overflow: hidden;">
                                    <?php  
                                        foreach($functions as $func){
                                            //$right =$this->group->get_right_md_fc($module->module_id,$func->function_id);  
                                    ?>
                                        <input type="hidden" name="arr_right[<?=$i;?>][group_id]" value=""/>
                                        <input type="hidden" name="arr_right[<?=$i;?>][module_id]" value="<?php echo $module->module_id; ?>"/>
                                        <input type="hidden" name="arr_right[<?=$i;?>][function_id]" value="<?php echo $func->function_id; ?>"/>
                                        <input type="hidden" name="arr_right[<?=$i;?>][right_id]" value=""/>
                                        <br/>
                                        <div class="function_name"><input type="checkbox" name="fc_<?php echo $i;?>" id="fc_<?php echo $i;?>" onclick ="check_chose_function('fc_<?php echo $i;?>','<?php echo $i;?>','checknew')"><span><b><?php echo $func->function_name; ?></b></span></div>
                                        <div style="overflow: hidden;">
                                            <?php foreach($permission as $pm){ ?>
                                            <span class="permit_name"><input type="checkbox" name="arr_permission[<?=$i;?>][<?=$pm->permission_code?>]"  value="1"> <?=$pm->permission_name?></span>
                                            <?php } ?>
                                        </div>
                                    <?php $i++;} ?>
                                         <script>
                                             total_num = '<?php echo $i; ?>';
                                         </script>
                                </div>
                            </td>
                        </tr>
                    <?php
                            $k=1-$k;

                        } 
                    ?>  
                </table>
            </td>
        </tr>
    </table>
    <?=form_close();?>
</div>
